package com.czl.dxpro.dx_01_clear;
import java.io.IOException;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
public class DxClearMain {
	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
		Configuration conf = new Configuration();
		conf.set("mapreduce.map.memory.mb", "2048");
		//设置map内存
		Job job=Job.getInstance(conf);
		job.setJarByClass(DxClearMain.class);
		job.setMapperClass(DxClearMapper.class);
		job.setNumReduceTasks(0);
		
		job.setOutputKeyClass(NullWritable.class);
		job.setOutputValueClass(Text.class);
	    TextInputFormat.setMinInputSplitSize(job,1024*1024*64L); // 最小分片大小
	    TextInputFormat.setMaxInputSplitSize(job,1024*1024*128L); //最大分片大小
	    //输入路径
		FileInputFormat.addInputPath(job, new Path("d://data/dx/input//dxdata.txt"));
		//输出路径
		FileOutputFormat.setOutputPath(job, new Path("d://data/dx/DxClear"));
		//提交作业 判断退出条件（0正常退出，1非正常退出）
		System.exit(job.waitForCompletion(true) ? 0 : 1);

	}

}
